#ifndef AXISSPRITE_H
#define AXISSPRITE_H

#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <QPoint>
#include <QList>

#include "axistiledmap.hpp"

class AxisTiledMapScene;

class AxisSprite
{
public:
    AxisSprite();
    AxisSprite(int widthgrid, int heightgrid, int wgridsize, int hgridsize);
    void setSize(int widthgrid, int heightgrid, int wgridsize, int hgridsize);
    int getWidth(){ return _map.getMapWidth(); }
    int getHeight(){ return _map.getMapHeight(); }
    void setScene(AxisTiledMapScene* scene);
    QPoint pos() const { return QPoint(_gridx, _gridy); }

    void updatePos(int gridx, int gridy);
    QList<QPoint> getArea() const;
    void choose(bool b);

    QRectF boundingRect() const;
    void paint(QPainter *painter);


protected:
    QPolygonF calPolygonPath(int x, int y);

protected:
    AxisTiledMapBase _map;
    QPoint _centerpos;
    QRectF _rect;
    QList<QPoint> _area;
    int _gridx = 0;
    int _gridy = 0;

    bool _showselectcircle = false;
    bool _showblock = true;
    bool _showaxis = true;

    AxisTiledMapScene* _scene;
};

#endif // AXISSPRITE_H
